<me:UIAE05 x:Class="WPFExcelReport.TMEVAR"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
          xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
          xmlns:me="clr-namespace:WPFExcelReport" 
          xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
          xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
          xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
          xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
          xmlns:AM="clr-namespace:WPFExcelReport;assembly=TAMEINST" 
          xmlns:Localization="clr-namespace:Localization;assembly=Localization"
          x:Name="TV"
          Loaded="Window_Loaded"
     >
    <me:UIAE05.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:DividebyM x:Key="dm"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIAE05.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/> 
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <WrapPanel Grid.Row="0" Grid.Column="0">
            <TextBlock Text="{Binding Source={Localization:Translate Word=工艺组合}}"/>
        </WrapPanel>
        <Grid Grid.Row="1" Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="1*"></RowDefinition>
            </Grid.RowDefinitions> 
            <StackPanel Grid.Row="0" >
                <StackPanel  VerticalAlignment="Top" >
                    <WrapPanel Visibility="Collapsed">
                        <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <DR:TDRAUFTR  Grid.Column="0" Name="cDR" DocType="{Binding PRTYPE,ElementName=TV}" PrintType="OpenExcel" />
                            <Button  Grid.Column="1"   Click="btnPrint_Click" Height="20" Margin="5,0,0,0" Width="Auto" Content="{Binding Source={Localization:Translate Word=打印确认函}}" />
                        </Grid>
                    </WrapPanel>
                    <WrapPanel Visibility="Collapsed">

                        <Button  Click="EditCommand" Width="24" Height="20" IsEnabled="{Binding IsCanChg,ElementName=TV}" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                            </Button.Background>
                        </Button>
                        <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" Visibility="Collapsed">
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                            </Button.Background>
                        </Button>
                        <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"  IsEnabled="{Binding IsCanDelete,ElementName=TV}" Visibility="Collapsed">
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                            </Button.Background>
                        </Button>


                        <Grid Margin="10,0,0,0" VerticalAlignment="Top" Visibility="Collapsed"  >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock FontSize="16"  Text="{Binding Source={Localization:Translate Word=设定}}"/>
                            <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="2"   IsAutoClear="True" 
                              CharacterCasing="Upper" Text="{Binding KRS,ElementName=TV}" Width="30" />
                            <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="4"  IsAutoClear="True" 
                              Text="{Binding LFD,ElementName=TV}"  Width="90" />
                            <ex:TXT72 Grid.Column="2" FontSize="16" Margin="5,0,0,0" MaxLength="4"  IsAutoClear="True" 
                              Text="{Binding POS,ElementName=TV}"   Width="40" />
                        </Grid>
                        <Button Grid.Column="0"  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" Visibility="Collapsed" >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                            </Button.Background>
                        </Button>
                       
                    </WrapPanel>
                    <WrapPanel>
                        <TextBlock  Text="{Binding Source={Localization:Translate Word=值}}"/>
                        <TextBlock  Text="{Binding MEVEINSTNR}" Width="24" />
                        <TextBlock  Text="{Binding Source={Localization:Translate Word=:}}"/>
                        <ex:TXT72  Text="{Binding MEVWERTX}" Width="120" Visibility="Collapsed" />
                        <ex:TXT72  Text="{Binding MEVWERTN,Converter={StaticResource dm}}" Width="120" />
                    </WrapPanel>
                </StackPanel>
                <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                    <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="3"   IsAutoClear="True" 
                          PRE="000"
                              CharacterCasing="Upper" Text="{Binding ART,ElementName=TV}" Width="40" />
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </StackPanel>
            <DataGrid  Grid.Row="1" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"  
                    >
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding AMEKBEZ,Converter={StaticResource gb2312}}"  Header="{Binding Source={Localization:Translate Word=说明}}" Width="50"/>
                    <DataGridTextColumn Binding="{Binding MEVEINSTNR}" Header="{Binding Source={Localization:Translate Word=项目}}" Width="Auto"/>
                    <DataGridTextColumn  Binding="{Binding MEVWERTX}" Header="{Binding Source={Localization:Translate Word=参数值}}" Visibility="Collapsed" Width="Auto"/>
                    <DataGridTextColumn  Binding="{Binding MEVWERTN,Converter={StaticResource dm}}" Header="{Binding Source={Localization:Translate Word=参数值}}"  Width="Auto"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
        <WrapPanel Grid.Row="0" Grid.Column="1">
            <TextBlock Text="{Binding Source={Localization:Translate Word=控制项}}"/>
        </WrapPanel>
        <AM:TAM06S  Grid.Row="1" Grid.Column="1"
                    IsEnabled="False"
                    Name="cAM06" 
                    EXAUF="{Binding MACHINEID,ElementName=TV}"   />
    </Grid>
     
</me:UIAE05>
